package com.vcc.service.service;

import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson2.JSONObject;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.vcc.core.model.AmountData;
import com.vcc.data.entity.CardOrder;
import com.vcc.data.entity.Role;
import com.vcc.service.client.vo.cardOrder.CardOrderVo;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface CardOrderService extends IService<CardOrder> {

    Page<CardOrder> paging(
            Page<CardOrder> page,
            Long userId,
            Long cardTypeId,
            String orderNo,
            String channel,
            String orderType,
            String orderStatus,
            String cardNumber,
            String startDate,
            String endDate,
            Long userCardId,
            Long dealerId
    );

    Page<CardOrderVo> paging(
            Page<CardOrderVo> pageable,
            Long userId,
            Long targetUserId,
            Long cardTypeId,
            String orderNo,
            String channel,
            Role role,
            String orderType,
            String orderStatus,
            String cardNumber,
            Date startDate,
            Date endDate,
            String orderSource,
            Long userCardId

    );

    CardOrder getByOrderId(String orderId);

    Boolean updateStatusByOrderId(String orderId, Integer status);

    Boolean updateStatusAndCardNumberByOrderId(String orderId, Integer status, Long cardNumberId, String cardNumber);

    Boolean openCardComplete(String orderId, String cardNumber, Long cardNumberId, String status);

    Boolean openShareCardComplete(String orderId, String cardNumber, Long cardNumberId, String status);

    Boolean rechargeCardComplete(String orderId, String cardNumber, Long cardNumberId, String status);

    Boolean withdrawCardComplete(String orderId, String cardNumber, Long cardNumberId, String status);

    Boolean setLimitComplete(String orderId, String status);

    Boolean blockCardComplete(String orderId, String status);

    Boolean unblockCardComplete(String orderId, String status);

    Boolean closeCardComplete(String orderId, String status);

    CardOrder openCard(
            Long shareAccountId,
            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String channel,
            BigDecimal orderAmount,
            String orderCurrency,
            String remark,
            String orderSource
    );


    CardOrder rechargeCard(

            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String cardNumber,
            Long cardNumberId,
            String channel,
            BigDecimal orderAmount,
            String orderCurrency,
            String remark,
            String orderSource
    );

    CardOrder withdrawCard(
            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String cardNumber,
            Long cardNumberId,
            String channel,
            BigDecimal orderAmount,
            String orderCurrency,
            String remark,
            String orderSource
    );

    CardOrder setLimit(
            Long shareAccountId,
            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String cardNumber,
            Long cardNumberId,
            String channel,
            BigDecimal limitAmount,
            String limitCurrency,
            String remark,
            String orderSource
    );

    CardOrder blockCard(
            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String cardNumber,
            Long cardNumberId,
            String channel,
            String remark,
            String orderSource
    );

    CardOrder unblockCard(
            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String cardNumber,
            Long cardNumberId,
            String channel,
            String remark,
            String orderSource
    );

    CardOrder closeCard(
            String orderId,
            Long cardTypeId,
            Long userId,
            Long operatorUserId,
            String cardNumber,
            Long cardNumberId,
            String channel,
            String remark,
            String orderSource
    );

    List<AmountData> countAmountByUserId(Long userId,String orderType,Date startDate, Date endDate);

    List<JSONObject> statistics();

    List<JSONObject> statistics(DateTime startDate, DateTime endDate);

    List<JSONObject> statistics(DateTime startDate, DateTime endDate, Long userId,Long dealerId);

    List<JSONObject> cardTypeStatistics(DateTime startDate, DateTime endDate, List<Long> cardTypeIds);

}
